<!--  -->
<template>
    <div class='add'>
        <el-form ref="form" :model="teacher" label-width="80px">
            <el-form-item label="添加日期">
                <el-input v-model="teacher.date"></el-input>
            </el-form-item>
            <el-form-item label="姓名">
                <el-input v-model="teacher.name"></el-input>
            </el-form-item>
            <el-form-item label="科目">
                <el-input v-model="teacher.lesson"></el-input>
            </el-form-item>
            <el-form-item label="">
                <el-button type="primary" @click="add">提交</el-button>
            </el-form-item>
        </el-form>
    </div>
</template>

<script>
/* eslint-disable */ // 忽略该行往下 eslint的错误
    //这里可以导入其他文件（比如：组件，工具js，第三方插件js，json文件，图片文件等等）

    export default {
        //import引入的组件需要注入到对象中才能使用
        components: {},
        data() {
            return {
              teacher:{
                id:new Date().getTime(),
                date:'',
                name:'',
                lesson:''
              }
            };
        },
        computed: {},
        watch: {},
        methods: {
            async add() {
                let data = await this.$post('http://localhost:8080/add',this.teacher)
                alert('添加成功')
            }
        },
        created() {
        },
    }

</script>
<style scoped>
</style>
